<!DOCTYPE html>
<html lang="ZH-ch">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原神角色排行榜</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Microsoft YaHei', Arial, sans-serif;
        }
        .title{
            color: white;
            font-weight: 400;
            width: 400px;
            height: 100px;
            background-color: hsla(0, 100%, 50%, 0.861);
            text-align: center;
            padding: 10px;
            margin: auto;
        }
        .title-text {
            font-size: 18px;
            margin-bottom: 15px; 
        }
        .part1,.part2{
            padding: 5px 0;
            margin: 0;
            vertical-align: top;
            display: inline-block;
            width: 160px;
            height: 30px;
            text-align: center;
            color: white;
            font-weight: 200;
            background-color: brown;
            border: 0.1px solid rgba(180, 13, 13, 0.852);
        }
        .part1 {
                border-radius: 5px 0 0 5px;
                margin-right: -5px;
        }

        .part2 {
            border-radius: 0 5px 5px 0;
            background-color: hsla(0, 92%, 43%, 0.468);
        }

        img{
            width: 20px;
            height: 20px;
        }

        .secongpart {
            background-color: white;
            width: 400px;
            height: 50px;
            margin: auto;
            border: 1px solid #ddd;
            border-radius: 1px 1px 0 0 ;
            border-top: none;
            position: relative; 
            box-shadow: 0 5px 10px -5px rgba(0, 0, 0, 0.3);
        }
        
        .wenzhang1 {
            position: absolute; 
            top: 12px; 
            left: 15px; 
            width: 61px;
            height: 26px;
            font-size: 14px;
            color: black;
            border-radius: 4px;
            font-weight: 300;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid white;
            background-color: rgb(211, 205, 205);
        }
        .wenzhang2{
            position: absolute; 
            top: 12px; 
            left: 85px; 
            width: 60px;
            height: 25px;
            background-color: red;
            font-size: 14px;
            color: white;
            border-radius: 4px;
            font-weight: 200;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 0.2px solid #c0392b;
        }
        .back{
            width: 400px;
            height: 1300px;
            background-color: hsl(0, 21%, 94%);
            margin: auto;
        }
        .song{
            width: 280px;
            height: 235px;
            padding: 5px;
            background-color: #27363e;
            margin: auto;
            border-radius: 10px;
            box-shadow: 
                0 2px 4px rgba(0, 0, 0, 0.2),
                0 8px 16px rgba(0, 0, 0, 0.3);
        }

        a{
            color:white;
            text-decoration: none;
            padding-bottom: 0;
            margin-bottom: 0;
        }
        a:hover{
            color:blue;
        }
        .device-display {
            position: relative; 
            width: 540px;
            height: 300px;
            border-radius: 40px;
        }
         /* 底层 */
        .background-image {
            width: 50%;
            height: 50%;
            object-fit: cover;
            border-radius: 2px;
        }
        
        /* 覆盖层 */
        .overlay-image {
            position:absolute;
            top: 0px;      
            left: 0px;   
            width: 35px;
            height: 15px;
            object-fit: cover;
            border-radius: 0 3px 3px 0;
            box-shadow: 0 5px 15px rgba(0,0,0,0.7);
            z-index: 10; 
            transition: all 0.3s ease;
        }
        .text{
            font-size: 15px;
            width: 280px;
            height: 25px;
            color: black;
            font-weight: 500;
        }
        .applause{
            font-size: 10px;
            width: 270px;
            height: 30px;
            color: grey;
            text-align: right;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 15px;
        }
        .like-btn {
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .like-btn:hover {
            transform: scale(1.1);
        }
        .like-btn.liked {
            color: #e74c3c;
        }
        .like-btn.liked .like-icon {
            animation: likeAnimation 0.6s ease;
        }
        @keyframes likeAnimation {
            0% { transform: scale(1); }
            50% { transform: scale(1.3); }
            100% { transform: scale(1); }
        }
    </style>
</head>
<body>
    <div>
        <div class="title">
            <div class="title-text">排行榜</div>
            <div>
                <div class="part1">
                    <a href="#">角色保值性</a>
                </div>
                <div class="part2">
                    <a href="#">角色热度</a>
                </div>
            </div>
        </div>
        <div class="secongpart">
            <span class="wenzhang1"><a href="#">全部</a></span>
            <span class="wenzhang2"><a href="#">限定五星</a></span>
        </div>
        <div class="back">
            <br>
            <!-- 角色1 -->
            <div class="song">
                <div class="device-display">
                    <img src="https://upload-bbs.miyoushe.com/upload/2023/11/07/295172274/2089d9b6f542ad77859d629953c6cd2e_9081176703886903601.png?x-oss-process=image/resize,s_600/quality,q_80/auto-orient,0/interlace,1/format,png" 
                    alt="水神芙宁娜" class="background-image">
                    <img src="imgs/rank-top1.png" alt="TOP1" class="overlay-image">
                    <div class="text"><a href="https://homdgcat.wiki/gi/char#_Furina" 
                        style= "color: rgb(128,192,255);font-size:large;" target="_blank" title="点击看角色详情" >
                        水神芙宁娜2+0（水）</a>
                    </div>
                    <div style="color: gray; font-size: small;">全队巨额增伤和不俗后台伤害</div>
                    <div class="applause">
                        <span>💬<span class="comment-count">4533</span></span>
                        <span class="like-btn" onclick="likePost(this)">
                            <span class="like-icon">👍</span>
                            <span class="like-count">113454</span>
                        </span>
                    </div>
                </div>
            </div><br/>
            
            <!-- 角色2 -->
            <div class="song">
                <div class="device-display">
                    <img src="https://i.bobopic.com/small/123095301.jpg" 
                    alt="希诺宁" class="background-image">
                    <img src="imgs/rank-top2.png" alt="TOP2" class="overlay-image">
                    <div class="text"><a href="https://homdgcat.wiki/gi/char#_Xilonen" 
                        style= "color:#ffe699; font-size:large;" target="_blank" title="点击看角色详情">
                        希诺宁0+1（岩）</a></div>
                    <div style="color: gray; font-size: small;">长轴增伤和减抗</div>
                    <div class="applause">
                        <span>💬<span class="comment-count">433</span></span>
                        <span class="like-btn" onclick="likePost(this)">
                            <span class="like-icon">👍</span>
                            <span class="like-count">97537</span>
                        </span>
                    </div>
                </div>
            </div><br/>
            
            <!-- 角色3 -->
            <div class="song">
                <div class="device-display">
                    <img src="https://upload-bbs.miyoushe.com/upload/2021/06/28/194965066/67dd49fe547f1e8428902c3be9433e3d_543888636013274478.jpg" 
                    alt="枫原万叶" class="background-image">
                    <img src="imgs/rank-top3.png" alt="TOP3" class="overlay-image">
                    <div class="text"><a href="https://homdgcat.wiki/gi/char#_Kazuha" 
                        style= "color:#80ffd7;font-size:large;" target="_blank" title="点击看角色详情">
                        枫原万叶0+0（风）</a></div>
                    <div style="color: gray; font-size: small;">短轴增伤减抗和聚怪</div>
                    <div class="applause">
                        <span>💬<span class="comment-count">5589</span></span>
                        <span class="like-btn" onclick="likePost(this)">
                            <span class="like-icon">👍</span>
                            <span class="like-count">65598</span>
                        </span>
                    </div>
                </div>
            </div><br/>

            <!-- 角色4 -->
            <div class="song">
                <div class="device-display">
                    <img src="https://www.jsqtj.com/public/images/6a7cf48bc7202e0efc13ddab03c046c2/20241227/a42785b9509667622c8171fb333f15b7.jpg" 
                    alt="茜特拉利" class="background-image">
                    <img src="imgs/rank-top4.png" alt="TOP4" class="overlay-image">
                    <div class="text"><a href="https://homdgcat.wiki/gi/char#_Citlali" 
                        style= "color:#99ffff; font-size:large;" target="_blank" title="点击看角色详情">茜特拉利2+1（冰）</a></div>
                    <div style="color: gray; font-size: small;">后台挂冰、护盾、减抗、元素精通加成</div>

                    <div class="applause">
                        <span>💬<span class="comment-count">1764</span></span>
                        <span class="like-btn" onclick="likePost(this)">
                            <span class="like-icon">👍</span>
                            <span class="like-count">94567</span>
                        </span>
                    </div>
                </div>
            </div><br/>

            <!-- 角色5 -->
            <div class="song">
                <div class="device-display">
                    <img src="qq_pic_merged_1758729053797.jpg" 
                    alt="火神玛威卡" class="background-image">
                    <img src="imgs/rank-top5.png" alt="TOP5" class="overlay-image">
                    <div class="text"><a href="https://homdgcat.wiki/gi/char#_Mavuika" 
                        style= "color:#ff9999;font-size:large;" target="_blank" title="点击看角色详情">火神玛威卡0+1（火）</a></div>
                    <div style="color: gray; font-size: small;">后台挂火、高额伤害、前台增伤</div>
                    <div class="applause">
                        <span>💬<span class="comment-count">5334</span></span>
                        <span class="like-btn" onclick="likePost(this)">
                            <span class="like-icon">👍</span>
                            <span class="like-count">43566</span>
                        </span>
                    </div> 
                </div>
            </div>
        </div>
    </div>

    <script>
        // 点赞功能
        function likePost(button) {
            const likeCountElement = button.querySelector('.like-count');
            let likeCount = parseInt(likeCountElement.textContent);
            
            // 检查是否已经点赞过
            if (button.classList.contains('liked')) {
                // 取消点赞
                likeCount--;
                button.classList.remove('liked');
            } else {
                // 点赞
                likeCount++;
                button.classList.add('liked');
            }
            
            // 更新点赞数
            likeCountElement.textContent = likeCount;
        }

        // 添加键盘支持（按L键点赞）
        document.addEventListener('keydown', function(event) {
            if (event.key === 'l' || event.key === 'L') {
                // 获取当前聚焦的元素
                const activeElement = document.activeElement;
                if (activeElement.closest('.song')) {
                    const likeBtn = activeElement.closest('.song').querySelector('.like-btn');
                    if (likeBtn) {
                        likePost(likeBtn);
                    }
                }
            }
        });

        // 添加触摸设备支持
        document.querySelectorAll('.like-btn').forEach(btn => {
            btn.addEventListener('touchstart', function(e) {
                e.preventDefault();
                likePost(this);
            });
        });
    </script>
</body>
</html>